package cn.xhy.module.purchase.service.materialdemand.listener;

import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEvent;
import cn.iocoder.yudao.module.bpm.event.BpmProcessInstanceStatusEventListener;

import cn.xhy.module.purchase.service.materialdemand.MaterialDemandService;
import cn.xhy.module.purchase.service.materialdemand.MaterialDemandServiceImpl;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 合同审批的结果的监听器实现类
 *
 * @author HUIHUI
 */
@Component
public class MaterialStatusListener extends BpmProcessInstanceStatusEventListener {

    @Resource
    private MaterialDemandService materialDemand ;

    @Override
    public String getProcessDefinitionKey() {
        return MaterialDemandServiceImpl.BPM_PROCESS_DEFINITION_KEY;
    }

    @Override
    protected void onEvent(BpmProcessInstanceStatusEvent event) {
        materialDemand.updateContractAuditStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
    }

}
